{
  "properties" : { },
  "id" : "a16fbeb7a58b4f6fbb3afc73b854003b",
  "script" : null,
  "groupId" : "bbb3f7cbdae84a879ddfa9acd99022ff",
  "name" : "所有字段",
  "createTime" : null,
  "updateTime" : 1667485170802,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/parmById",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": -1,\n    \"message\": \"系统内部出现错误\",\n    \"data\": null,\n    \"timestamp\": 1666331939576,\n    \"executeTime\": 17\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "-1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "系统内部出现错误",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "null",
      "description" : "",
      "required" : false,
      "dataType" : "Array",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1666331939576",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "17",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import log;

var sql = """ """;
var method = body.method;

if (method.equals("byId")) {
    if (body.parentId == '0') {
        sql = """
            SELECT
                t.ID id ,
                t.PARENT_ID parentId,
                t.LIBRARY_NAME libraryName,
                t.CREATE_BY createBy,
                t.CREATE_DATE createDate,
                t.DESCRIPTION description,
                t.UPDATE_BY updateBy,
                t.UPDATE_DATE updateDate,
                t.ORDERID orderId,
                t.PATH path,
                '目录根节点' parentName
            FROM
                as_group t where ID = #{body.id}
        """
    } else {
        sql = """
            SELECT
                t.ID id ,
                t.PARENT_ID parentId,
                t.LIBRARY_NAME libraryName,
                t.CREATE_BY createBy,
                t.CREATE_DATE createDate,
                t.DESCRIPTION description,
                t.UPDATE_BY updateBy,
                t.UPDATE_DATE updateDate,
                t.ORDERID orderId,
                t.PATH path,
                t2.LIBRARY_NAME parentName
            FROM
                as_group t,
                (
                    SELECT
                        ID,
                        LIBRARY_NAME
                    FROM
                        as_group
                ) t2
            WHERE
                t.PARENT_ID = t2.ID
            AND t.ID = #{body.id}
        """
    }
} else {
    sql = """ select * from as_group"""
}
return db.select(sql)